<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'supplier-product-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>
    
    <?php if (Yii::app()->controller->action->id == 'create'){ ?>
	<div class="row">
		<?php echo $form->labelEx($model,'product_id'); ?>
		<?php echo $form->dropDownList($model,'product_id',CHtml::listData(Product::model()->findAll(), 'id', 'name'), array('size' => 1)); ?>
		<?php echo $form->error($model,'product_id'); ?>
	</div>
    <?php } else{ ?>
    <div class="row">
		<?php echo $form->labelEx($model,'product_id'); ?>
		<?php echo CHtml::label(Product::model()->findByPk($model->product_id)->name,''); ?>
	</div>
    <?php } ?>

	<div class="row">
		<?php echo $form->labelEx($model,'unit_price'); ?>
		<?php echo $form->textField($model,'unit_price'); ?>
		<?php echo $form->error($model,'unit_price'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'unit'); ?>
		<?php echo $form->textField($model,'unit',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'unit'); ?>
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->